Technical Field
The present disclosure regards a reading circuit with automatic offset compensation for a magnetic-field sensor, in particular, an anisotropic magnetoresistive (AMR) magnetic sensor, and to a related reading method with automatic offset compensation.
Description of the Related Art
Magnetic-field sensors, in particular, AMR magnetic sensors, are used in a plurality of applications and systems, for example in compasses, in systems for detecting ferrous materials, in the detection of currents, and in a wide range of other applications, thanks to their capacity of detecting natural magnetic fields (for example the Earth's magnetic field) and magnetic fields generated by electrical components (such as electrical or electronic devices and lines traversed by electric current).
In a known way, the phenomenon of anisotropic magnetoresistivity occurs within particular ferrous materials, which, when subjected to an external magnetic field, undergo a variation of resistivity as a function of the characteristics of the same external magnetic field. Usually, these materials are applied as thin strips so as to form resistive elements, and the resistive elements thus formed are electrically connected to define a bridge structure (typically a Wheatstone bridge).
It is moreover known to produce AMR magnetic sensors with standard techniques of micromachining of semiconductors, as described, for example, in U.S. Pat. No. 4,847,584.
In particular, each magnetoresistive element can be formed by a film of magnetoresistive material, such as, for example, Permalloy (a ferromagnetic alloy containing iron and nickel), deposited to form a thin strip on a substrate of semiconductor material, for example silicon.
When an electric current is made to flow through a magnetoresistive element, the angle θ between the direction of magnetization of the magnetoresistive element and the direction of flow of the current affects the effective value of resistivity of the magnetoresistive element, so that, as the value of the angle θ varies, the value of electrical resistance varies (in detail, this variation follows a law of the cos2θ type). For example, a direction of magnetization parallel to the direction of the flow of current results in a maximum value of resistance to the passage of current through the magnetoresistive element, whereas a direction of magnetization orthogonal to the direction of the flow of current results in a minimum value of resistance to the passage of current through the magnetoresistive element.
In particular, magnetoresistive elements, ideally having the same value of resistance, are set in the Wheatstone bridge, such as to form diagonal pairs of equal elements, which react in a way opposite to one another to an external magnetic field, as shown schematically in FIG. 1 (where H designates the external magnetic field, I the electric current that flows in the magnetoresistive elements, and R the common value of resistance).
By applying a supply voltage Vs at input to the bridge detection structure (in particular, to first two terminals of the bridge, which operate as input terminals), in the presence of the external magnetic field H, a variation of resistance ΔR of the magnetoresistive elements occurs, with a corresponding variation of the value of voltage drop on the magnetoresistive elements; in fact, the external magnetic field H determines a variation of the direction of magnetization of the magnetoresistive elements. There follows an unbalancing of the bridge structure, as a voltage variation ΔV at output (in particular, between the remaining two terminals of the bridge, which operate as output terminals). Since the direction of the initial magnetization of the magnetoresistive elements is known beforehand, it is hence possible to determine, for example, the direction and intensity of the external magnetic field H that acts on the AMR magnetic sensor, as a function of the voltage variation ΔV.
Usually, a reading stage (or front-end) is used, coupled to the output of the AMR magnetic sensor and including, for example, an instrumentation amplifier for detecting the unbalancing of the Wheatstone bridge and generating an output signal indicative of the characteristics of the external magnetic field to be measured.
On account of the presence of mismatch between the values of resistance at rest (i.e., in the absence of external stimuli) of the various magnetoresistive elements, due, for example, to the manufacturing process or to phenomena of non-homogeneous ageing of the components, an offset signal (i.e., a deviation with respect to the value of the useful signal) is present on the output signal of the AMR magnetic sensor; this offset is hence intrinsic to the sensor, and its value is independent of the characteristics of the external magnetic field.
In general, the voltage variation ΔV at output from the bridge can hence be considered as the sum of a useful signal Vsig, indicating the external magnetic field, and an offset Voff:ΔV=Vsig+Voff 
In particular, even in the absence of external magnetic fields, the AMR magnetic sensor has a nonzero output signal, due precisely to the offset Voff. Given that the value of the offset is frequently comparable to, if not even higher than, the output signals due to the external magnetic field (in particular, when the sensor has to measure external magnetic fields of low value, for example the Earth's magnetic field in the case of compass applications), the presence of the offset causes errors and distortions in the measurements and moreover a reduction of the measurement scale that can be used (once the end-of-scale has been fixed). Furthermore, a possible increase of the end-of-scale of the sensor, in order to reduce the effect of the offset, disadvantageously entails a corresponding decrease in the measurement sensitivity and resolution.
Consequently, a wide range of techniques for compensation of the offset of the magnetic sensor have up to now been proposed, which are designed to reduce or at least limit the effects of the offset on the output of the sensor.
For example, a first compensation technique envisages the use of a resistor (the so-called “shunt resistor”) connected in parallel to one or more of the branches of the Wheatstone bridge (and hence to one or more of the corresponding magnetoresistive elements), the value of which is such as to balance the Wheatstone bridge and thus eliminate the offset at output from the sensor. The disadvantage of this compensation technique is due to the fact that, in order to determine the value of the shunt resistor, it is necessary to remove any external magnetic field (including the contribution due to the Earth's magnetic field), and it is hence necessary to provide a perfectly shielded environment, or, alternatively, a set of Helmholtz coils. This leads to an increase in the production costs and it is difficult to implement at a mass-production level.
A different offset-compensation technique envisages the use of coils integrated in the AMR magnetic sensors, the so-called “offset straps”, which are designed to generate, when flowed by a current of appropriate value, a magnetic field in the direction of detection. The value of the magnetic field generated is such as to balance the Wheatstone bridge, so that the sensor, feeling both the external magnetic field and the magnetic field generated internally by the offset straps, supplies an output signal without the offset contribution (the offset is intrinsically compensated within the AMR magnetic sensor).
This technique has the disadvantage of involving considerable power consumption (also due to the fact that frequently the offset is greater than the signals to be detected), because of the current circulating in the offset straps during operation of the sensor. In addition, this technique requires a controlled environment, in which to measure, during a calibration step, the contribution of the offset in the absence of external magnetic fields, so as to adjust accordingly the value of current that is to flow through the offset straps and the value of the compensation magnetic field to be generated internally.
A further proposed technique envisages the use of means for orientation of the direction of magnetization of the magnetoresistive elements belonging to the AMR magnetic sensors. In particular, these orientation means comprise coils or “straps”, integrated in the AMR magnetic sensors, which are designed to generate, when flowed by current, a magnetic field with predefined direction and orientation; these coils are known as “set/reset straps”.
For example, the set/reset straps are provided on the same substrate on which the magnetoresistive elements of the sensor are provided, being electrically insulated from, and set in the proximity of, the same magnetoresistive elements.
In use, the orientation of the direction of magnetization is obtained by applying to the magnetoresistive elements, via the set/reset straps, an intense magnetic field for a short period of time, having a value such as to force and align the orientation of the magnetic dipoles of the magnetoresistive elements in a first predefined direction (“set” pulse), or else in a second predefined direction, opposite to the first direction (“reset” pulse), according to the direction of the magnetic field generated (and hence in a way coherent with the direction of the current circulating in the set/reset straps). The aforementioned set and reset operations are known and described in detail, for example, in U.S. Pat. No. 5,247,278.
Reversal of the orientation of the magnetic dipoles causes inversion of the signal at output from the Wheatstone bridge, in the presence of an external magnetic field. Instead, the offset signal superimposed on the useful signal in the output signal does not invert its own polarity, since it is due exclusively to mismatches between the components internal to the sensor and is hence independent of the characteristics of the external magnetic field.
Consequently, the offset-compensation procedure envisages in this case application of a set pulse and, after waiting an appropriate relaxation time such as to eliminate possible current tails and allow settling of the magnetic dipoles of the ferromagnetic material, acquisition of a first sample of the output signal (for example, a voltage signal, Vout) in the presence of the external magnetic field H; the first sample of the output signal, designated by Voutset is given byVoutset=H·S+Voutoff where S is the sensitivity of the AMR magnetic sensor and Voutoff is the offset signal superimposed on the output.
Next, a reset pulse is applied and, after waiting an appropriate relaxation time such as to eliminate possible current tails and allow settling of the magnetic dipoles of the ferromagnetic material, a second sample of the output signal is acquired to obtainVoutreset=H·(−S)+Voutoff where −S is the value of sensitivity of the AMR magnetic sensor, having in this case a value equal and opposite to the value of sensitivity S during the set operation, on account of the reversal of the sense of the magnetic dipoles of the magnetoresistive elements of the sensor.
A subtraction between the first sample and the second sample acquired is then carried out, from which it is possible to derive the useful signal, thus cancelling out the effects of the offset contribution on the output signal:(Voutset−Voutreset)=H·S+Voutoff−(H·(−S)+Voutoff)=2H·S 
This technique (known as “subtraction method”) hence envisages digital cancelling-out of the offset during digital processing of the output signals (carried out by an external electronic unit, which receives the output signals from the reading stage coupled to the sensor); by processing of the output signals, the value of the useful signal is obtained, discriminating it from the offset signal Voutoff. However, the offset is in any case present at output from the AMR magnetic sensor and at input to the corresponding reading stage during the compensation procedure. In some cases, the value of the offset can be such as to saturate the reading chain. In this case, due to saturation, the reading stage supplies at output an erroneous sample, and consequently the compensation operation carried out may prove erroneous.
It follows that the various offset-compensation techniques that have so far been proposed each suffer from respective drawbacks that do not enable full exploitation of their specific advantages.